detect stop codon

104

detect stop codon -

stop_codons = ["TGA", "TAG", "TAA"]
sequence = "ATGAAATGA"
sequence2 = "ATGAAATTA"

is_stop_codon = lambda x : any(x[i:i+3] in stop_codons for i in range(0,len(x),3))

print is_stop_codon(sequence)
print is_stop_codon(sequence2)

Comments

Submit
1 Comments
  • 2/7/2023 15:42 - Asia/Shanghai

CAAATTGTGATTTGGCGCGCGACGGCGGCCAGCTGCCGCTGCTCGTTGTTTTTTCTGCAATGATATTTGGGACTATTACAAATCAAGATCTGCCTGTGATCAAGTGTGTTTTAATCAATCATAAGAACAATGATTCATCAGTGGGGAAATCATCATCATATCCCATGGTATCAGAATCCCCGGAAGACCTCGGGTGTGCGTTGAGACCCCAGAGCTCAGGGACAGTGTACGAAGCTGCCGCTGTGGAAGTGGATGTATCTGCTTCCATCACACTGCAAGTGCTGGTCGATGCCCCAGGGAACATTTCCTGTCTCTGGGTCTTTAAGCACAGCTCCCTGAATTGCCAGCCACATTTTGATTTACAAAACAGAGGAGTTGTTTCCATGGTCATTTTGAAAATGACAGAAACCCAAGCTGGAGAATACCTACTTTTTATTCAGAGTGAAGCTACCAATTACACAATATTGTTTACAGTGAGTATAAGAAATACCCTGCTTTACACATTAAGAAGACCTTACTTTAGAAAAATGGAAAACCAGGACGCCCTGGTCTGCATATCTGAGAGCGTTCCAGAGCCGATCGTGGAATGGGTGCTTTGCGATTCACAGGGGGAAAGCTGTAAAGAAGAAAGTCCAGCTGTTGTTAAAAAGGAGGAAAAAGTGCTTCATGAATTATTTGGGATGGACATAAGGTGCTGTGCCAGAAATGAACTGGGCAGGGAATGCACCAGGCTGTTCACAATAGATCTAAATCAAACTCCTCAGACCACATTGCCACAATTATTTCTTAAAGTAGGGGAACCCTTATGGATAAGGTGCAAAGCTGTTCATGTGAACCATGGATTCGGGCTCACCTGGGAATTAGAAAACAAAGCACTCGAGGAGGGCAACTACTTTGAGATGAGTACCTATTCAACAAACAGAACTATGATACGGATTCTGTTTGCTTTTGTATCATCAGTGGCAAGAAACGACACCGGATACTACACTTGTTCCTCTTCAAAGCATCCCAGTCAATCAGCTTTGGGTACCATCGTAGAAAAGGGATTTATAAATGCTACCAATTCAGTGAAGATTATGAAATGACAATATGAAAAGTTGTTTTCTTCAGGTTAAGCCTCCACCAACTAGATGTACGTGGACCTCTCCCGAATCATTTCTTGTGAGCAAAAGGTTGTTTCGGGT